# -*- coding: utf-8 -*-
##############################################################################
# @Project: product bom
# @QQ: 373500710
# @邮箱: 373500710@qq.com
# @手机: 18505121385
# @作者: elvis
# @Date: 2016-03-31
# @日期: 2016 StyleOdoo Inc. All rights reserved.
##############################################################################

from openerp import models, fields


class ProductBom(models.Model):
    _inherit = "product.product"

    @api.model
    def _get_default_team(self):
        if self.customer.pricelist_id and self.customer:
            return = self.env['account.tax']._fix_tax_included_price(product.price, product.taxes_id, self.tax_id)

    # _columns
    customer = fields.Many2one('res.partner', '客户',
                               select=True
                               )
    sequence = fields.Integer(string="序号", readonly=True)
    sub_product = fields.Many2one('product.product', '产品子件',
                                  select=True
                                  )
    uom_id = fields.Many2one('product.uom', '单位',
                             select=True
                             )
    spec_id = fields.Many2one('product.specification', '规格',
                              select=True
                              )
    dosage = fields.Float(string="用量")
    attration_rate = fields.Float(string="损耗率%")
    price_unit = fields.Float(string="单价", default=_get_default_team)
